<%-- 
    Document   : loanCollectionContent
    Created on : May 4, 2011, 2:12:01 AM
    Author     : MacBook
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>


<s:div id="collection" cssStyle="overflow:auto;height:530px">
    <s:set name="stat" value="actstatus"/>
    <s:set name="prev" value="statprevious"/>
    <s:set name="view" value="view"/>

    <s:if test="%{#privilegeView.allowable == false}">
        <script type="text/javascript">window.location="home.jsp";</script>
    </s:if>
    <jsp:include page="../../WEB-INF/fragments/searchcollection.jsp"/>
    <s:form action="save-deposit" id="bottom" cssStyle="font-size:12px;width:800px;clear:both" theme="simple" name="bottom">
        <script type="text/javascript">
            $(document).ready(function(){
                $('div#collinfo td').find('input').attr('disabled','disabled');
                $('div#savedbtmdetails td').find('input').attr('disabled','disabled');
            });
        </script>
        <s:div id="collinfo" style="float: left; width: 800px;font-size:12px;">
            <table>
                <tr>
                    <td><s:label>Branch Code</s:label></td>
                    <td><s:textfield label="Branch Code" type="text" id="b" cssClass="branchid" readonly="true" /></td>
                    <td>&nbsp;</td>
                    <td><s:label>Sequence</s:label></td>
                    <td><s:textfield id="sequence" name="sequence" label="Sequence" value="%{#request['collection'].collectionid}" readonly="true"/></td>
                </tr>
                <tr>
                    <td><s:label>Document</s:label></td>
                    <td><s:textfield id="document" name="document" label="Document" value="%{#request['collection'].documents.documenttype}" readonly="true"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><s:label>Document Date</s:label></td>
                    <td><input id="datecoll" label="Date" name="datecoll" value="${request.collection.documents.documentdate}"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><s:label>Area Code</s:label></td>
                    <td><s:textfield value="%{#request['collection'].areas.areacode}" name="acodecoll"/></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><s:label>AR Code</s:label></td>
                    <td><s:textfield id="ccodecoll" name="ccodecoll" cssClass="ccode" label="AR Code" value="%{#request['collection'].employees.employeeid}"/></td>
                    <td><p id="errorcoll" style="display: none;color:red">Error</p></td>
                    <td><s:label>AR Name</s:label></td>
                    <td><s:textfield id="cnamecoll" name="cnamecoll" label="AR Name" value="%{#request['collection'].employees.completename}"/></td>
                </tr>
            </table>
        </s:div>

        <s:div id="bottomcoll">
            <h3 style="float:left;clear:both">Daily Collection Form</h3>

            <s:div cssStyle="clear:both;float:left;margin-left:3em;margin-bottom:1em" id="savedpayment">
                <table border="1px" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Series</th>
                            <th style="width:140px">Borrower Code</th>
                            <th>Borrower Name</th>
                            <th style="width:170px">Official Receipt No.</th>
                            <th style="width:120px">Amount</th>
                            <th style="width:80px">Payment</th>
                        </tr>
                    </thead>
                    <tbody>
                        <s:iterator value="#request.paylist">
                            <tr>
                                <td style="width:50px"><label><s:property value="seriesno"/></label></td>
                                <td><label><s:property value="borrowerid"/></label></td>
                                <td><label><s:property value="completename"/></label></td>
                                <td><label><s:property value="receiptno"/></label></td>
                                <td><label><s:property value="amount"/></label></td>
                                <td><label><s:property value="type"/></label>
                            </tr>
                        </s:iterator>
                    </tbody>
                </table>
            </s:div>


            <s:div id="savedbtmdetails">    <!--previous/next-->
                <table style="clear:both">
                    <tr>
                        <td><s:label>Total Collection</s:label></td>
                        <td><s:textfield type="text" id="totalc" name="totalc" label="Total Collection" value="%{#request['collection'].totalamountcollected}" cssClass="money" readonly="true"/></td>
                    </tr>
                    <tr id="sectr">
                        <td><s:label>Cash Deposited</s:label></td>
                        <td><s:textfield id="cashdeposit" class="money" name="cashdeposit" label="Cash Deposited" value="%{#request['collection'].depositamount}"/></td>
                        <td><s:label>Deposit No.</s:label></td>
                        <td><s:textfield id="cshdepositnum" name="cshdepositnum" label="Deposit No." value="%{#request['collection'].depositno}"/></td>
                        <td><s:label>Bank Account No.</s:label></td>
                        <td><s:textfield id="bankacctnum" name="bankacctnum" label="Bank Account No." value="%{#session['branch'].bankaccountnum}"/></td>
                    </tr>
                    <tr id="totaltr">
                        <td><s:label>Undeposited Cash</s:label></td>
                        <td><s:textfield id="cashonhand" cssClass="money" name="cashonhand" label="Undeposited Cash" value="%{#request['collection'].cashonhand}"/></td>
                    </tr>
                    <tr>
                        <td><s:label>Cash Short or Over</s:label></td>
                        <td><s:textfield type="text" id="cashshort" cssClass="money" name="cashshort" label="Cash Short or Over" value="%{#request['collection'].short_}"/></td>
                    </tr>
                </table>
            </s:div>

        </s:div>
    </s:form>
    <s:div id="btmbutton" cssStyle="position:fixed;width:600px;margin-left:25em;margin-top:5em">


        <s:form id="getseq" action="get-seq" cssStyle="clear:left" theme="simple">
            <script type="text/javascript">
                $(document).ready(function(){
                    $('#prev').click(function(e){
                        var sequence = $('#sequence').val();
                        if(sequence==''){
                            alert('Sequence Number is not specified');
                            document.getElementById('getseq').submit= false;
                        }else{
                            $('#sampleseqp').val(parseInt(sequence)-1);
                            document.getElementById('getseq').submit();
                        }
                    });
                                            
                    $('#nxtseq').click(function(e){
                        var sequence = $('#sequence').val();
                        if(sequence==''){
                            alert('Sequence Number is not specified');
                            document.getElementById('getseq').submit= false;
                        }else{
                            $('#sampleseqp').val(parseInt(sequence)+1);
                            document.getElementById('getseq').submit();
                        }
                    });
                                            
                });

            </script>
            <s:textfield name="sampleseq" id="sampleseqp" cssClass="sampleseq" cssStyle="display:none;" />
            <sj:submit id="prev" button="true" cssClass="ui-state-default" cssStyle="clear:left;float:right;font-size:14px;" value="Previous"/>
            <sj:submit id="nxtseq" button="true" cssClass="ui-state-default" cssStyle="float:right;font-size:14px;" value="Next"/>
        </s:form>
        <sj:a id="searchbtn" button="true" cssClass="ui-state-default" cssStyle="float:right;font-size:14px;margin-top:2px" value="Search">Search</sj:a>
        <%--<s:form theme="simple">
            <sj:submit button="true" cssClass="ui-state-default" cssStyle="float:right;font-size:14px;" value="Search"/>
        </s:form>--%>
        <s:form name="newcollect" action="new-coll" theme="simple">
            <sj:submit id="createnew" button="true" cssClass="ui-state-default" cssStyle="float:right;font-size:14px;" value="Create New"/>
        </s:form>
    </s:div>
</s:div>